/*
 * Copyright 2022 MindMotion Microelectronics Co., Ltd.
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */


#ifndef __BOARD_INIT_H__
#define __BOARD_INIT_H__

#include <stdio.h>
#include <stdint.h>

#include "hal_common.h"
#include "hal_rcc.h"
#include "hal_qspi.h"

#include "clock_init.h"
#include "pin_init.h"

/* APP BASE. */
#define BOARD_APP_BASE                  0x90000000

/* QSPI. */
#define BOARD_QSPI_SCK_DIV              4u
#define BOARD_QSPI_RX_DELAY_CYCLES      1u
#define BOARD_QSPI_CS_HIGH_LEVEL_TIME   2u

/* cmd. */
#define BOARD_EXT_FLASH_CMD_BUS_WIDTH   QSPI_BusWidth_1b
#define BOARD_EXT_FLASH_CMD_VALUE       0x6B /* fast read quad. */
#define BOARD_EXT_FLASH_ADDR_BUS_WIDTH  QSPI_BusWidth_1b
#define BOARD_EXT_FLASH_ADDR_WORD_WIDTH QSPI_WordWidth_24b
#define BOARD_EXT_FLASH_DUMMY_CYCLES    8u
#define BOARD_EXT_FLASH_DATA_BUS_WIDTH  QSPI_BusWidth_4b

void BOARD_Init(void);
void jump_to_app(uint32_t app_base);

#endif /* __BOARD_INIT_H__ */
